 
 <?php
    if ($deal->view == -1):
        echo $deal->view;
    else: 
    $is_sold_out = ($deal->number_voucher_max <= $deal->count_voucher_buy) || ( $deal->time_to_expire <= 0);
 ?>
<div class="item_deal" id="d_<?=$deal->id?>" onclick="redirect_url('/deal/detail/<?=$deal->id?>')" onmouseover="show_title_deal(<?=$deal->id?>)" onmouseout="hide_title_deal(<?=$deal->id?>)" >
        <!-- Title deal -->
        <div name='title' class="title_deal" style="display: none;">
            <label><?=substr($deal->deal_name,0,20);?></label>
        </div>
        
        <!-- Show stick payment price-->
        <div class="stick-notice">
            <?php if($is_sold_out): ?>
            <div class="sold_out">
                <div style="display: table-cell; vertical-align: middle;font-weight:bold;color:white;">
                    <span style="font-size:14pt;" >Sold Out</span>
                </div>
            </div>
            <?php else: ?>
            <div class="only_payment">
                <div style="display: table-cell; vertical-align: middle;font-weight:bold;color:white;">
                    <span style="font-size:13pt;" >$<?=$deal->payment_price?></span>/<span style="font-size: 11px;">voucher</span>
                </div>
            </div>
            <?php endif; ?>
        </div>
    
        <!-- Image -->
        <img class="thumnail_deal" src="/<?=$deal->picture2;?>" />

        <!-- Detail -->
        <table style="width: 100%;text-align: center;">
            <tr >
                <td style="width: 50%;"><label class="lbl_normal">Save</label></td>
                <td><label class="lbl_normal">Bought</label></td>
            </tr>
            <tr>
                <td>
                    <?php if($deal->view == VIEW_PRICE):  //display price?>
                        $<label class="price"><?=$deal->price;?></label>
                        <label class="special_price">$<?=$deal->special_price;?></label>
                    <?php elseif($deal->view == VIEW_PERCENT): ?>
                        <label class="percent"> <?=(int)($deal->special_price * 100 / $deal->price);?>%</label>
                    <?php endif; ?> 
                </td>
                <td>
                    <label style="font-size: 14px; font-weight: bold; color: #8E1116;"><?=$deal->count_voucher_buy?>/<?=$deal->number_voucher_max?></label>
                </td>
            </tr>
        </table>
</div>              
<?php endif; ?>